﻿using Microsoft.Extensions.DependencyInjection;
using System;

namespace Xman.Dapper.Sqlite
{
    public static class DapperServiceCollectionExtensions
    {
        public static IServiceCollection AddDapperContext<T,K>(this IServiceCollection services,Action<K> setupAction) where T: SqlContext where K: SqliteContextOptions
        {
            if(setupAction!=null)
            {
                services.Configure(setupAction);
            }
            services.AddSingleton<T>();
            return services;
        }
    }
}
